﻿$(function () {
    //信息添加、编辑页面加载时修改form的action地址
    setAct();
});


//信息添加、编辑页面加载时修改form的action地址
var setAct = function (formid) {
    var form;
    if (formid == null || formid == undefined || formid == "") {
        form = $("form").eq(0);
    } else {
        form = $("#" + formid).eq(0);
    }
    if (form.length == 0) {
        form = $("form").eq(0);
    }

    var url = myurl();
    var formaction = myurl(form.attr("action"));


    //当地址中act= add时
    if (url.attr("act") == "add") {
        formaction.attr("act", "addsave");
    }

    //当url中act=edit时
    if (url.attr("act") == "edit") {
        formaction.attr("act", "editsave");
    }
    form.attr("action", formaction.newHref);
}
//setAct  end

